Skip to content

Conversation

@bsurmanski
Copy link
Contributor

Remove cfg!(target_os="x") from build.rs

using the cfg macro breaks cross compilation. This is because the cfg
macro gets evaluated during compile time of the binary getting built. In
the case of build.rs, it gets built into it's own binary targeting the
local machine. (Which then gets run to evaluate build rules for the
primary project binary). So somewhat confusingly, the cfg(target_os..)
evaluates differently in build.rs than the rest of the project in the
case of cross compilation. Particularly for SDL, this is important for
targeting emscripten. The current build.rs breaks when trying to compile
for the web.

using the cfg macro breaks cross compilation. This is because the cfg
macro gets evaluated during compile time of the binary getting built. In
the case of build.rs, it gets built into it's own binary targeting the
local machine. (Which then gets run to evaluate build rules for the
primary project binary). So somewhat confusingly, the cfg(target_os..)
evaluates differently in build.rs than the rest of the project in the
case of cross compilation. Particularly for SDL, this is important for
targeting emscripten. The current build.rs breaks when trying to compile
for the web.
@bsurmanski
Copy link
Contributor Author

This should fix: #884

@bsurmanski bsurmanski marked this pull request as ready for review November 1, 2019 01:13
That is the target_os visible in the target triple.
@Cobrand
Copy link
Member

Cobrand commented Nov 1, 2019

That's a good point, thanks!

@Cobrand Cobrand merged commit a8e9955 into Rust-SDL2:master Nov 1, 2019
@bsurmanski bsurmanski mentioned this pull request Nov 1, 2019
sypwex pushed a commit to sypwex/rust-sdl2 that referenced this pull request Jun 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants